<!--

    Copyright © 2016-2025 The Thingsboard Authors

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<div #homeChartsContainer class="tb-home-card-container" style="overflow: auto; padding: 18px 8px 18px 18px">
  <div class="tb-card-header">
    <tb-card-title-button [cardType]="cardType" [disabled]="false"></tb-card-title-button>
    <div class="flex flex-row items-center gap-2">
      <button mat-icon-button class="tb-mat-24" [disabled]="chartsCarouselIndex === 0" (click)="chartsCarouselIndex = chartsCarouselIndex - 1"><mat-icon>keyboard_arrow_left</mat-icon></button>
      <button mat-icon-button class="tb-mat-24" [disabled]="chartsCarouselIndex >= chartKeys?.length - items" (click)="chartsCarouselIndex = chartsCarouselIndex + 1"><mat-icon>keyboard_arrow_right</mat-icon></button>
    </div>
  </div>
  <div class="tb-home-charts">
    <ngx-hm-carousel #carousel
      align="left"
      [(ngModel)]="chartsCarouselIndex"
      [drag-many]="true"
      [show-num]="items"
      [data]="chartKeys"
      class="carousel c-accent">
      <section ngx-hm-carousel-container class="content">
        @for (chart of chartKeys; track chart) {
          <article class="item cursor-pointer"
            ngx-hm-carousel-item>
            <div class="chart-container flex flex-col">
              <section class="flex flex-row gap-1.5 whitespace-nowrap">
                <span>{{ chartTypeTranslationMap.get(chart) | translate }}</span>
                <mat-icon class="home-page-material-icons" style="padding: 0; display: block"
                  [matTooltip]="chartTooltip(chart)">
                  info_outline
                </mat-icon>
              </section>
              <section [style]="{'width': chartWidth, 'height': chartHeight}">
                <canvas [id]="chart+chartPage"></canvas>
              </section>
            </div>
          </article>
        }
      </section>
    </ngx-hm-carousel>
  </div>
</div>
